<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<th:block th:include="common/head :: head('安全摘要')"/>
<style>
  .index-header-menus, .index-header-gray {
    display: none;
  }
  .index-block3 {
    height: auto;
  }
</style>
<body>
<th:block th:include="common/head :: header('/web/safety')"/>


<div class="page-main index-block3">
  <div class="common-block-title">
    <img class="common-block-title__ico" src="/img/document.png">
    <span class="common-block-title__txt">安全摘要</span>
  </div>
  <div class="common-block-content list-wrap">
    <div id="listWrap">

    </div>
    <div class="page-wrap" id="pageEl"></div>
  </div>
</div>



<th:block th:include="common/head :: link"/>
<th:block th:include="common/head :: footer"/>
</body>
<th:block th:replace="include :: laypage-js" />
<script th:inline="javascript">
  const pageSize = 10

  loadData(1)

  function loadData(pageNum){
    $.ajax({
      url: ctx + 'web/loadContentPage',
      type: 'post',
      data: {
        pageNum: pageNum,
        pageSize: pageSize,
        kind: 'SAFE'
      },
      dataType: 'json',
      success: function(res) {
        console.info('res:', res)
        const pages = Math.ceil(res.total/pageSize)
        buildList(res.rows)

        laypage({
          cont: 'pageEl',
          curr: pageNum,
          pages: pages,
          jump: function(obj, first){
            if(!first) {
              loadData(obj.curr)
            }
          }
        })
      }
    })
  }


  function buildList(list) {
    $('#listWrap').html('')

    const htmls = []

    list.forEach(item => {
      htmls.push('<div class="safe-item">')
      htmls.push('  <a class="safe-item-title" title="'+item.title+'" href="/web/safety/view/'+item.uuid+'">'+item.title+'</a>')
      htmls.push('  <a class="safe-item-more" href="/web/safety/view/'+item.uuid+'">阅读详情</a>')
      htmls.push('</div>')
    })

    $('#listWrap').html(htmls.join(''))
  }
</script>
</html>

